package org.example.domain;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SysUser implements Serializable {
    /**
     *用户ID
     */
    @ExcelProperty(value = {"用户编号"})
    private Long userId;
    /**
     *部门ID
     */
    @ExcelProperty(value = {"部门编号"})
    @NotNull(message = "部门编号不为空")
    private Long deptId;
    /**
     *用户账号
     */
    @ExcelProperty(value = {"用户账号"})
    @NotBlank(message = "用户不为空")
    private String userName;
    /**
     *用户昵称
     */
    @ExcelProperty(value = {"用户昵称"})
    private String nickName;
    /**
     *用户类型（00系统用户）
     */
    @ExcelProperty(value = {"用户类型"})
    private String userType;
    /**
     *用户邮箱
     */
    @ExcelProperty(value = {"用户邮箱"})
    private String email;
    /**
     *手机号码
     */
    @ExcelProperty(value = {"手机号码"})
    @NotBlank(message = "手机号不为空")
    private String phonenumber;
    /**
     *用户性别（0男 1女 2未知）
     */
    @ExcelProperty(value = {"用户性别"})
    @NotBlank(message = "性别不为空")
    private String sex;
    /**
     *头像地址
     */
    @ExcelIgnore
    private String avatar;
    /**
     *密码
     */
    @ExcelIgnore
    @NotBlank(message = "用户密码不为空")
    private String password;
    /**
     *帐号状态（0正常 1停用）
     */
    @ExcelProperty(value = {"帐号状态"})
    @NotBlank(message = "帐号状态不为空")
    private String status;
    /**
     *删除标志（0代表存在 2代表删除）
     */
    @ExcelIgnore
    private String delFlag;
    /**
     *最后登录IP
     */
    @ExcelIgnore
    private String loginIp;
    /**
     *最后登录时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = {"最后登录时间"})
    private Date loginDate;
    /**
     *创建者
     */
    @ExcelProperty(value = {"创建者"})
    private String createBy;
    /**
     *创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = {"创建时间"})
    private Date createTime;
    /**
     *更新者
     */
    @ExcelIgnore
    private String updateBy;
    /**
     *更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date updateTime;
    /**
     *备注
     */
    @ExcelIgnore
    @NotBlank(message = "备注不为空")
    private String remark;
    @ExcelIgnore
    private Long pid;
    @ExcelIgnore
    private Long sid;
    @ExcelIgnore
    private Long xid;
    //扩展字段
    private String pname;
    @ExcelIgnore
    private Long roleId;
    @ExcelIgnore
    private String sname;
    @ExcelIgnore
    private String xname;
    @ExcelIgnore
    private String deptName;
    @ExcelIgnore
    private String postName;
    @ExcelIgnore
    private String roleName;
    @ExcelIgnore
    private String uid;
    @ExcelIgnore
    private String code;
    @ExcelIgnore
    @NotNull(message = "角色编号不为空")
    private Long[] rids;
    @ExcelIgnore
    @NotNull(message = "岗位编号不为空")
    private Long[] postsId;
}
